﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using EntityObjects;
using BAL.Controller;

namespace PresentationLayer.View
{
    public partial class Noti : System.Web.UI.UserControl
    {
        List<Requisition> reqList;
        ApproveRequisitionController appReqCtrl = new ApproveRequisitionController();
        Employee employee = new Employee();
        protected void Page_Load(object sender, EventArgs e)
        {

                 try
            {
                if (!IsPostBack)
                {
                    Bind();
                    
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('Error!!! Plz try again later');</script>");

            }
        }
          protected void Bind()
        {
              employee=(Employee)Session["CurrentUser"];
            int Count = 0;
            string depId=employee.DeptId;
            reqList = appReqCtrl.getRequisitionByDeptIdAndAppliedStatus(depId);
            Count = reqList.Count();
            if (Count == 0)
                Label1.Text = "No requisition available for approval!!";
            else
                               
            Noti_DeptHead.Text = "New Requisitions: " + Count;
          
          
        }

        }
    }
